<template>
	<view>
		<!-- 已结算收益 -->
		<view class="bg-white radius" v-for="(item, index) in list" :key="index">
			<view class="margin-sm padding-tb-sm solids-bottom padding-left">结算年月：{{ item.settleMonth | formatMonthDate }}</view>
			<view class="margin-sm padding-bottom-xs solids-bottom padding-left text-bold">
				我的返佣订单：
				<text class="text-red padding-right-xs">{{ item.product.settleCount }}</text>
				笔订单
			</view>
			<view class="margin-sm padding-bottom-xs solids-bottom padding-left-xxl flex" v-for="(pitem, pindex) in item.product.currencyList" :key="pindex">
				<view style="width: 130rpx;">{{ pitem.settleCurrency | CurrencyText }}</view>
				<view
					:class="{ 'text-rmb': pitem.settleCurrency == 'CNY', 'text-btc': pitem.settleCurrency == 'BTC', 'text-eth': pitem.settleCurrency == 'ETH' }"
				>
					{{ FixedCeilCoin(pitem.settleAmount, pitem.settleCurrency) }}
				</view>
			</view>
			<view class="margin-sm padding-bottom-xs solids-bottom padding-left-xxl flex">
				<view style="width: 120rpx;">BTC</view>
				<view class="padding-left-xs text-btc">{{ FixedCeilCoin('2.25', 'BTC') }}</view>
			</view>
			<view class="margin-sm padding-bottom-xs solids-bottom padding-left-xxl flex">
				<view style="width: 120rpx;text-">ETH</view>
				<view class="padding-left-xs text-eth">{{ FixedCeilCoin('2.205', 'ETH') }}</view>
			</view>
			<view class="margin-sm padding-bottom-xs solids-bottom padding-left text-bold">
				大掌柜返佣订单：
				<text class="text-red padding-right-xs">{{ item.firstUser.settleCount }}</text>
				笔订单
			</view>
			<view class="margin-sm padding-bottom-xs solids-bottom padding-left-xxl flex" v-for="(pitem, pindex) in item.firstUser.currencyList" :key="pindex">
				<view style="width: 130rpx;">{{ pitem.settleCurrency | CurrencyText }}</view>
				<view
					:class="{ 'text-rmb': pitem.settleCurrency == 'CNY', 'text-btc': pitem.settleCurrency == 'BTC', 'text-eth': pitem.settleCurrency == 'ETH' }"
				>
					{{ FixedCeilCoin(pitem.settleAmount, pitem.settleCurrency) }}
				</view>
			</view>

			<view class="margin-sm padding-bottom-xs solids-bottom padding-left text-bold">
				二掌柜返佣订单：
				<text class="text-red padding-right-xs">{{ item.secondUser.settleCount }}</text>
				笔订单
			</view>
			<view class="margin-sm padding-bottom-xs solids-bottom padding-left-xxl flex" v-for="(pitem, pindex) in item.secondUser.currencyList" :key="pindex">
				<view style="width: 130rpx; ">{{ pitem.settleCurrency | CurrencyText }}</view>
				<view
					:class="{ 'text-rmb': pitem.settleCurrency == 'CNY', 'text-btc': pitem.settleCurrency == 'BTC', 'text-eth': pitem.settleCurrency == 'ETH' }"
				>
					{{ FixedCeilCoin(pitem.settleAmount, pitem.settleCurrency) }}
				</view>
			</view>
			<view class="padding-bottom-xs"></view>
		</view>
	</view>
</template>

<script>
export default {
	props: {
		list: {
			// 数据列表
			type: Array,
			default() {
				return [];
			}
		}
	},
	methods: {
		currencyIconColor(currency) {
			return currency == 'CNY' ? '#ff0000' : value == 'BTC' ? '#FDA806' : '#497391';
		},
		FixedCeilCoin(amount, currency) {
			let len = currency == 'CNY' ? 2 : currency == 'BTC' ? 8 : 6;
			console.log(amount, len, currency);
			return this.$util.FixedCeilCoin(amount, len);
		}
	},
	filters: {
		//结算币种
		CurrencyText: function(currency) {
			return currency == 'CNY' ? '人民币' : currency;
		},
		//时间戳过滤器年月
		formatMonthDate: function(value) {
			let tmp = '';
			if (value) {
				let date = new Date(value);
				let y = date.getFullYear();
				let MM = date.getMonth() + 1;
				tmp = y + '年' + MM + '月';
			}
			return tmp;
		}
	}
};
</script>

<style lang="scss">
.one-line {
	display: -webkit-box;
	-webkit-box-orient: vertical;
	-webkit-line-clamp: 1;
	overflow: hidden;
}
</style>
